import { get, post, put, del } from '@/utils/request'

// 获取所有知识文档
export async function getKnowledges() {
  return await get('/api/knowledges')
}

// 根据ID获取知识文档
export async function getKnowledge(knoId) {
  return await get(`/api/knowledge/${knoId}`)
}

// 创建知识文档
export async function createKnowledge(data) {
  return await post('/api/knowledge', data)
}

// 更新知识文档
export async function updateKnowledge(knoId, data) {
  return await put(`/api/knowledge/${knoId}`, data)
}

// 删除知识文档
export async function deleteKnowledge(knoId) {
  return await del(`/api/knowledge/${knoId}`)
}

// 获取知识文档统计信息
export async function getKnowledgeStats() {
  return await get('/api/knowledge/stats')
}

// 预览知识文档
export function getKnowledgePreviewUrl(knoId) {
  return `/api/knowledge/${knoId}/preview`
}